package com.example.server.web.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.server.web.config.CustomAuthorityDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 
 * </p>
 *
 * @author 作者
 * @since 2023-04-04
 */
@Getter
@Setter
@TableName("sys_user")
@ApiModel(value = "SysUser对象", description = "")
public class SysUser implements Serializable{

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("用户id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("用户账号（学号/工号）")
    @NotBlank(message = "用户账号（学号/工号）不能为空")
    private String username;

    @ApiModelProperty("用户名字")
    @NotBlank(message = "名字不能为空")
    private String name;

    @ApiModelProperty("用户性别(0代表男，1代表女)")
    @NotBlank(message = "用户性别不能为空")
    private String sex;

    @ApiModelProperty("年龄")
    @Min(value = 0,message = "最小年龄不能为0")
    private Integer age;

    @ApiModelProperty("用户头像")
    private String avatar;

    @ApiModelProperty("用户密码")
    private String password;

    @ApiModelProperty("是否启用（1代表启用，0代表禁用）")
    private Boolean enabled;



}
